<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Document</title>
	<style type="text/css">
		.box{
			width: 400px;
			height: 400px;
			background: red url() 0 0 no-repeat;
		}
		.son{
			width: 200px;
			height: 200px;
			background: blue url() 0 0 no-repeat;
		}
		.other{
			width: 100px;
			height: 100px;
			background: yellow url() 0 0 no-repeat;
		}
	</style>

	<script type="text/javascript">
	 	window.onload = function  () {

	 		var box = document.getElementsByName('username');

		 	console.log(box);

		 	box[0].style.backgroundColor='green';
	 	}
	</script>
</head>
<body>
	<div class="box" id="box">
		<div class="son">
			<input type="text" name="username">
			<p>这个可以有</p>
		</div>
	</div>
	<div class="box other" ></div>
</body>
</html>